<!DOCTYPE html>
<html class="cbioportal-frontend" lang="en">
<head>

    <script th:if="${googleTagManagerId != null}" th:inline="javascript">
        (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
        new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
        j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
        'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
        })(window,document,'script','dataLayer',/*[[${googleTagManagerId}]]*/);
    </script>

    <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
 
    <link rel="icon" href="/images/cbioportal_icon.png"/>
    <title>cBioPortal for Cancer Genomics</title>
    
    <script>
        
        var postData = [(${postData})];

        window.frontendConfig = {
            configurationServiceUrl:    "//" + '[(${baseUrl})]' +  "/config_service",
            appVersion:                 '[(${appVersion})]',
            apiRoot:                    '//'+ '[(${baseUrl})]/', 
            baseUrl:                    '[(${baseUrl})]',
            basePath:                   '[(${contextPath})]',  
        };
        //
        <!-- write configuration to page so we do not have to load it via service-->
        window.rawServerConfig = [(${propertiesJson})];

        if (/localdev=true/.test(window.location.href)) {
            localStorage.setItem("localdev", "true");
        }
        if (/localdist=true/.test(window.location.href)) {
            localStorage.setItem("localdist", "true");
        }
        window.localdev = localStorage.localdev === 'true';
        window.localdist = localStorage.localdist === 'true';
        window.netlify = localStorage.netlify;

        if (window.localdev || window.localdist) {
            window.frontendConfig.frontendUrl = "https://localhost:3000/"
            localStorage.setItem("e2etest", "true");
        } else if (window.netlify) {
            window.frontendConfig.frontendUrl = ['//',localStorage.netlify,'.netlify.app','/'].join('');
            localStorage.setItem("e2etest", "true");
        } else if ('[(${frontendUrl})]') {
            window.frontendConfig.frontendUrl = '[(${frontendUrl})]';
        }

        if(!window.frontendConfig.frontendUrl) {
            window.frontendConfig.frontendUrl = '//' + '[(${baseUrl})]/';
        }

    </script>
     
    <script type="text/javascript" th:src="@{'/js/load-frontend.js'(${@environment.getProperty('app.version')})}" />
    
    <script>
        window.frontendConfig.customTabs && window.frontendConfig.customTabs.forEach(function(tab){
            if (tab.pathsToJs) {
                tab.pathsToJs.forEach(function(src){
                    document.write('<scr'+'ipt type="text/javascript" src="'+ src +'"></sc'+'ript>');
                });
            }
        });
    </script>

    <script>
        loadAppStyles(window.frontendConfig);
    </script>
    
    <div th:replace="~{tracking_include}" />

    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />

</head>

<body>

    <noscript th:if="${googleTagManagerId != null}">
        <iframe th:src="'https://www.googletagmanager.com/ns.html?id=' + ${googleTagManagerId}"
                height="0" width="0" style="display:none;visibility:hidden"></iframe>
    </noscript>

    <script>
        loadReactApp(window.frontendConfig);
    </script>

    <div id="reactRoot"></div>

</body>
</html>
